```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Spring Boot 自定义配置指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        .hero {
            background: linear-gradient(135deg, #6B73FF 0%, #000DFF 100%);
        }
        .card {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        }
        .code-block {
            font-family: 'Courier New', Courier, monospace;
            background-color: #f8f9fa;
            border-radius: 6px;
            position: relative;
        }
        .code-block:before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 4px;
            height: 100%;
            background: #3B82F6;
            border-radius: 6px 0 0 6px;
        }
        .highlight {
            background: linear-gradient(90deg, rgba(255, 255, 255, 0) 50%, rgba(59, 130, 246, 0.2) 50%);
            background-size: 200% 100%;
            transition: all 0.3s ease;
        }
        .highlight:hover {
            background-position: -100% 0;
        }
        .drop-cap:first-letter {
            float: left;
            font-size: 4.5rem;
            line-height: 0.65;
            margin: 0.1em 0.2em 0.1em 0;
            color: #3B82F6;
            font-weight: 700;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl px-4">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-5xl font-bold mb-4 font-serif">
                        Spring Boot 自定义配置
                    </h1>
                    <p class="text-xl md:text-2xl mb-6 opacity-90">
                        掌握配置管理的艺术，构建灵活高效的应用程序
                    </p>
                    <div class="flex space-x-4">
                        <span class="px-4 py-2 bg-white bg-opacity-20 rounded-full text-sm font-medium">
                            <i class="fas fa-cog mr-2"></i>配置类
                        </span>
                        <span class="px-4 py-2 bg-white bg-opacity-20 rounded-full text-sm font-medium">
                            <i class="fas fa-file-code mr-2"></i>配置文件
                        </span>
                        <span class="px-4 py-2 bg-white bg-opacity-20 rounded-full text-sm font-medium">
                            <i class="fas fa-sliders-h mr-2"></i>环境变量
                        </span>
                    </div>
                </div>
                <div class="md:w-1/2">
                    <div class="code-block p-6 text-sm md:text-base">
                        <div class="flex mb-4">
                            <span class="text-gray-500 mr-4">1</span>
                            <span class="text-blue-400">@Configuration</span>
                        </div>
                        <div class="flex mb-4">
                            <span class="text-gray-500 mr-4">2</span>
                            <span class="text-blue-400">@ConfigurationProperties</span>(prefix = <span class="text-green-400">"myapp.custom"</span>)
                        </div>
                        <div class="flex mb-4">
                            <span class="text-gray-500 mr-4">3</span>
                            <span class="text-purple-400">public class</span> <span class="text-yellow-400">CustomProperties</span> {
                        </div>
                        <div class="flex mb-4">
                            <span class="text-gray-500 mr-4">4</span>
                            &nbsp;&nbsp;<span class="text-purple-400">private</span> String property;
                        </div>
                        <div class="flex mb-4">
                            <span class="text-gray-500 mr-4">5</span>
                            &nbsp;&nbsp;<span class="text-purple-400">private</span> <span class="text-purple-400">int</span> number;
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">6</span>
                            }
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-5xl px-4 py-12">
        <!-- Introduction -->
        <section class="mb-16">
            <div class="drop-cap text-gray-800 leading-relaxed">
                在Spring Boot中，自定义配置的定义和读取可以通过多种方式实现，包括配置文件、配置类、@Value注解或Environment对象。本文将详细介绍这些方法的用法和最佳实践，帮助您构建更加灵活和可维护的Spring Boot应用程序。
            </div>
        </section>

        <!-- 1. Define Custom Config -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 flex items-center">
                <span class="w-10 h-10 bg-blue-100 text-blue-600 rounded-full flex items-center justify-center mr-4">1</span>
                定义自定义配置
            </h2>

            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <!-- 1.1 Properties/YAML -->
                <div class="card bg-white p-6 rounded-xl">
                    <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-file-alt text-blue-500 mr-3"></i>
                        application.properties/yml
                    </h3>
                    <p class="text-gray-600 mb-4">
                        在Spring Boot中，默认的配置文件是<code class="bg-gray-100 px-1 rounded">application.properties</code>或<code class="bg-gray-100 px-1 rounded">application.yml</code>。
                    </p>
                    
                    <div class="space-y-4">
                        <div>
                            <h4 class="text-sm font-medium text-gray-500 mb-2">application.properties</h4>
                            <div class="code-block p-4">
                                <div class="flex">
                                    <span class="text-gray-500 mr-4">1</span>
                                    <span>myapp.custom.property=value</span>
                                </div>
                                <div class="flex">
                                    <span class="text-gray-500 mr-4">2</span>
                                    <span>myapp.custom.number=123</span>
                                </div>
                            </div>
                        </div>
                        
                        <div>
                            <h4 class="text-sm font-medium text-gray-500 mb-2">application.yml</h4>
                            <div class="code-block p-4">
                                <div class="flex">
                                    <span class="text-gray-500 mr-4">1</span>
                                    <span>myapp:</span>
                                </div>
                                <div class="flex">
                                    <span class="text-gray-500 mr-4">2</span>
                                    <span>&nbsp;&nbsp;custom:</span>
                                </div>
                                <div class="flex">
                                    <span class="text-gray-500 mr-4">3</span>
                                    <span>&nbsp;&nbsp;&nbsp;&nbsp;property: value</span>
                                </div>
                                <div class="flex">
                                    <span class="text-gray-500 mr-4">4</span>
                                    <span>&nbsp;&nbsp;&nbsp;&nbsp;number: 123</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 1.2 Configuration Class -->
                <div class="card bg-white p-6 rounded-xl">
                    <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-cogs text-purple-500 mr-3"></i>
                        配置类
                    </h3>
                    <p class="text-gray-600 mb-4">
                        通过创建配置类并使用<code class="bg-gray-100 px-1 rounded">@ConfigurationProperties</code>注解，可以实现结构化和类型安全的配置管理。
                    </p>
                    
                    <div class="code-block p-4 overflow-x-auto">
                        <div class="flex">
                            <span class="text-gray-500 mr-4">1</span>
                            <span class="text-blue-400">@Configuration</span>
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">2</span>
                            <span class="text-blue-400">@ConfigurationProperties</span>(prefix = <span class="text-green-400">"myapp.custom"</span>)
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">3</span>
                            <span class="text-purple-400">public class</span> <span class="text-yellow-400">CustomProperties</span> {
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">4</span>
                            &nbsp;&nbsp;<span class="text-purple-400">private</span> String property;
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">5</span>
                            &nbsp;&nbsp;<span class="text-purple-400">private</span> <span class="text-purple-400">int</span> number;
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">6</span>
                            }
                        </div>
                    </div>
                    
                    <div class="mt-4 text-sm text-gray-500">
                        <i class="fas fa-info-circle mr-2"></i>
                        在<code class="bg-gray-100 px-1 rounded">application.properties</code>或<code class="bg-gray-100 px-1 rounded">application.yml</code>中定义相应属性即可自动绑定。
                    </div>
                </div>
            </div>

            <!-- Usage in Application -->
            <div class="bg-white p-6 rounded-xl mb-8">
                <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                    <i class="fas fa-laptop-code text-green-500 mr-3"></i>
                    在Spring Boot应用中使用配置类
                </h3>
                <div class="code-block p-4 overflow-x-auto">
                    <div class="flex">
                        <span class="text-gray-500 mr-4">1</span>
                        <span class="text-blue-400">@RestController</span>
                    </div>
                    <div class="flex">
                        <span class="text-gray-500 mr-4">2</span>
                        <span class="text-purple-400">public class</span> <span class="text-yellow-400">MyController</span> {
                    </div>
                    <div class="flex">
                        <span class="text-gray-500 mr-4">3</span>
                        &nbsp;&nbsp;<span class="text-blue-400">@Autowired</span>
                    </div>
                    <div class="flex">
                        <span class="text-gray-500 mr-4">4</span>
                        &nbsp;&nbsp;<span class="text-purple-400">private</span> <span class="text-yellow-400">CustomProperties</span> customProperties;
                    </div>
                    <div class="flex">
                        <span class="text-gray-500 mr-4">5</span>
                        &nbsp;
                    </div>
                    <div class="flex">
                        <span class="text-gray-500 mr-4">6</span>
                        &nbsp;&nbsp;<span class="text-blue-400">@GetMapping</span>(<span class="text-green-400">"/config"</span>)
                    </div>
                    <div class="flex">
                        <span class="text-gray-500 mr-4">7</span>
                        &nbsp;&nbsp;<span class="text-purple-400">public</span> String getConfig() {
                    </div>
                    <div class="flex">
                        <span class="text-gray-500 mr-4">8</span>
                        &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-purple-400">return</span> <span class="text-green-400">"Property: "</span> + customProperties.getProperty() + 
                    </div>
                    <div class="flex">
                        <span class="text-gray-500 mr-4">9</span>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="text-green-400">", Number: "</span> + customProperties.getNumber();
                    </div>
                    <div class="flex">
                        <span class="text-gray-500 mr-4">10</span>
                        &nbsp;&nbsp;}
                    </div>
                    <div class="flex">
                        <span class="text-gray-500 mr-4">11</span>
                        }
                    </div>
                </div>
            </div>
        </section>

        <!-- 2. Read Custom Config -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 flex items-center">
                <span class="w-10 h-10 bg-blue-100 text-blue-600 rounded-full flex items-center justify-center mr-4">2</span>
                读取自定义配置
            </h2>

            <div class="grid md:grid-cols-2 gap-8">
                <!-- 2.1 @Value -->
                <div class="card bg-white p-6 rounded-xl">
                    <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-at text-indigo-500 mr-3"></i>
                        @Value 注解
                    </h3>
                    <p class="text-gray-600 mb-4">
                        使用<code class="bg-gray-100 px-1 rounded">@Value</code>注解可以直接将配置文件中的值注入到字段中。
                    </p>
                    
                    <div class="code-block p-4">
                        <div class="flex">
                            <span class="text-gray-500 mr-4">1</span>
                            <span class="text-blue-400">@Component</span>
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">2</span>
                            <span class="text-purple-400">public class</span> <span class="text-yellow-400">MyComponent</span> {
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">3</span>
                            &nbsp;&nbsp;<span class="text-blue-400">@Value</span>(<span class="text-green-400">"${myapp.custom.property}"</span>)
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">4</span>
                            &nbsp;&nbsp;<span class="text-purple-400">private</span> String property;
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">5</span>
                            &nbsp;
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">6</span>
                            &nbsp;&nbsp;<span class="text-blue-400">@Value</span>(<span class="text-green-400">"${myapp.custom.number}"</span>)
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">7</span>
                            &nbsp;&nbsp;<span class="text-purple-400">private</span> <span class="text-purple-400">int</span> number;
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">8</span>
                            }
                        </div>
                    </div>
                </div>

                <!-- 2.2 Environment -->
                <div class="card bg-white p-6 rounded-xl">
                    <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                        <i class="fas fa-server text-teal-500 mr-3"></i>
                        Environment 对象
                    </h3>
                    <p class="text-gray-600 mb-4">
                        通过<code class="bg-gray-100 px-1 rounded">Environment</code>对象可以在运行时动态读取配置属性。
                    </p>
                    
                    <div class="code-block p-4">
                        <div class="flex">
                            <span class="text-gray-500 mr-4">1</span>
                            <span class="text-blue-400">@Component</span>
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">2</span>
                            <span class="text-purple-400">public class</span> <span class="text-yellow-400">MyComponent</span> {
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">3</span>
                            &nbsp;&nbsp;<span class="text-blue-400">@Autowired</span>
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">4</span>
                            &nbsp;&nbsp;<span class="text-purple-400">private</span> <span class="text-yellow-400">Environment</span> environment;
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">5</span>
                            &nbsp;
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">6</span>
                            &nbsp;&nbsp;<span class="text-purple-400">public void</span> printProperties() {
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">7</span>
                            &nbsp;&nbsp;&nbsp;&nbsp;String property = environment.getProperty(<span class="text-green-400">"myapp.custom.property"</span>);
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">8</span>
                            &nbsp;&nbsp;&nbsp;&nbsp;<span class="text-purple-400">int</span> number = environment.getProperty(<span class="text-green-400">"myapp.custom.number"</span>, 
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">9</span>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="text-yellow-400">Integer</span>.<span class="text-purple-400">class</span>, <span class="text-purple-400">0</span>);
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">10</span>
                            &nbsp;&nbsp;}
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">11</span>
                            }
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- 3. Configuration Loading Priority -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 flex items-center">
                <span class="w-10 h-10 bg-blue-100 text-blue-600 rounded-full flex items-center justify-center mr-4">3</span>
                配置文件的加载优先级
            </h2>

            <p class="text-gray-600 mb-6">
                Spring Boot 配置文件的加载有优先级，以下是常见的优先级顺序（从高到低）：
            </p>
            
            <!-- Mermaid Diagram -->
            <div class="mermaid bg-white p-6 rounded-xl">
                graph TD
                    A[Command Line Properties] -->|最高优先级| B(Java System Properties)
                    B --> C(OS Environment Variables)
                    C --> D(application.properties/yml)
                    D --> E(@PropertySource)
                    E --> F[Default application.properties/yml]
            </div>

            <div class="mt-6 grid md:grid-cols-2 gap-6">
                <div class="bg-white p-6 rounded-xl">
                    <h3 class="text-xl font-semibold mb-4 text-gray-800">
                        <i class="fas fa-terminal text-orange-500 mr-3"></i>
                        命令行参数
                    </h3>
                    <p class="text-gray-600 mb-2">
                        通过<code class="bg-gray-100 px-1 rounded">--property=value</code>形式传递的参数具有最高优先级。
                    </p>
                    <div class="code-block p-4">
                        <div class="flex">
                            <span class="text-gray-500 mr-4">1</span>
                            <span>java -jar myapp.jar --myapp.custom.property=newValue</span>
                        </div>
                    </div>
                </div>
                
                <div class="bg-white p-6 rounded-xl">
                    <h3 class="text-xl font-semibold mb-4 text-gray-800">
                        <i class="fas fa-code text-purple-500 mr-3"></i>
                        @PropertySource 注解
                    </h3>
                    <p class="text-gray-600 mb-2">
                        使用<code class="bg-gray-100 px-1 rounded">@PropertySource</code>可以加载自定义配置文件。
                    </p>
                    <div class="code-block p-4">
                        <div class="flex">
                            <span class="text-gray-500 mr-4">1</span>
                            <span class="text-blue-400">@SpringBootApplication</span>
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">2</span>
                            <span class="text-blue-400">@PropertySource</span>(<span class="text-green-400">"classpath:custom.properties"</span>)
                        </div>
                        <div class="flex">
                            <span class="text-gray-500 mr-4">3</span>
                            <span class="text-purple-400">public class</span> <span class="text-yellow-400">MyApp</span> { ... }
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Best Practices -->
        <section class="mb-16 bg-blue-50 p-8 rounded-xl">
            <h2 class="text-3xl font-bold mb-6 text-blue-800 flex items-center">
                <i class="fas fa-star text-yellow-500 mr-4"></i>
                最佳实践建议
            </h2>
            
            <div class="grid md:grid-cols-3 gap-6">
                <div class="bg-white p-6 rounded-lg">
                    <div class="text-blue-500 text-2xl mb-3">
                        <i class="fas fa-project-diagram"></i>
                    </div>
                    <h3 class="text-lg font-semibold mb-2 text-gray-800">结构化配置</h3>
                    <p class="text-gray-600">
                        对于复杂的配置，使用<code class="bg-gray-100 px-1 rounded">@ConfigurationProperties</code>创建结构化的配置类，而不是分散的<code class="bg-gray-100 px-1 rounded">@Value</code>注解。
                    </p>
                </div>
                
                <div class="bg-white p-6 rounded-lg">
                    <div class="text-blue-500 text-2xl mb-3">
                        <i class="fas fa-file-signature"></i>
                    </div>
                    <h3 class="text-lg font-semibold mb-2 text-gray-800">类型安全</h3>
                    <p class="text-gray-600">
                        配置类提供了类型安全的好处，Spring Boot会自动进行类型转换和验证，减少运行时错误。
                    </p>
                </div>
                
                <div class="bg-white p-6 rounded-lg">
                    <div class="text-blue-500 text-2xl mb-3">
                        <i class="fas fa-layer-group"></i>
                    </div>
                    <h3 class="text-lg font-semibold mb-2 text-gray-800">环境隔离</h3>
                    <p class="text-gray-600">
                        使用<code class="bg-gray-100 px-1 rounded">application-{profile}.properties</code>为不同环境(dev, test, prod)提供特定配置。
                    </p>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-8">
        <div class="container mx-auto max-w-5xl px-4">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-medium text-white mb-2">技术小馆</h3>
                    <p class="text-gray-400">Spring Boot技术研究与分享</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-blue-300 hover:text-white transition-colors duration-200">
                        <i class="fas fa-external-link-alt mr-2"></i>
                        http://www.yuque.com/jtostring
                    </a>
                </div>
            </div>
            <div class="mt-8 pt-6 border-t border-gray-800 text-center text-gray-500 text-sm">
                &copy; 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // Add hover effect to code blocks
        document.querySelectorAll('.code-block').forEach(block => {
            block.addEventListener('mouseenter', () => {
                block.classList.add('ring-2', 'ring-blue-200');
            });
            block.addEventListener('mouseleave', () => {
                block.classList.remove('ring-2', 'ring-blue-200');
            });
        });
    </script>
</body>
</html>
```